<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改测点配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-config-edit" th:object="${tagConfig}">
            <input name="id" th:field="*{id}" type="hidden">
             <input name="groupid" th:field="*{groupid}" id = "groupid" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">分组名称：</label>
                <div class="col-sm-8">
                    <input  class="form-control"   th:field="*{groupname}" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" >
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测点名称：</label>
                <div class="col-sm-8">
                    <input name="tagname" th:field="*{tagname}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">PI测点名：</label>
                <div class="col-sm-8">
                    <input name="pitagname" th:field="*{pitagname}" class="form-control" type="text">
                </div>
            </div>
             <div class="form-group">    
                <label class="col-sm-3 control-label">计算类型：</label>
                <div class="col-sm-8">
                    <select  class="form-control" name="calctype" th:with="type=${@dict.getType('sys_tag_caltype')}">
                                     <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{calctype}"></option>
                   </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">限值类型：</label>
                <div class="col-sm-8">
                    <select  class="form-control" name="limittype" th:with="type=${@dict.getType('sys_tag_limittype')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{limittype}"></option>
                   </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">上限参数：</label>
                <div class="col-sm-8">
                    <input name="upperval" th:field="*{upperval}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">下限参数：</label>
                <div class="col-sm-8">
                    <input name="lowerval" th:field="*{lowerval}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">关联测点：</label>
                <div class="col-sm-8">
                    <input name="pitag" th:field="*{pitag}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
				<label class="col-sm-3 control-label">测点状态：</label>
				<div class="col-sm-8">
				    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}"  th:checked="${dict.default}">
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
				</div>
			</div>
            
        </form>
        <div class="form-group">
				<label class="col-sm-5 control-label" style="color: red">单限值例子： {0,0:595}</label>
			</div>
			<div class="form-group">
				<label class="col-sm-5 control-label" style="color: red">多限值例子： {0,0:595,605}</label>
			</div>
			<div class="form-group">
				<label class="col-sm-5 control-label" style="color: red">动态限值例子：{0,0:TEST2:(1,1)(90,4)}</label>
			</div>
			<div class="form-group">
				<label class="col-sm-5 control-label" style="color: red">启停值例子： {1,1:-458752} ,状态值根据测点查询</label>
			</div>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "tag/config";
        var prefix1 = ctx + "tag/group"
        $("#form-config-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
            }
        }
        /*部门管理-新增-选择父部门树*/
		function selectDeptTree() {
			var options = {
				title: '分组选择',
				width: "380",
				url: prefix1 + "/selectDeptTree/" + $("#groupid").val(),
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}
		
		function doSubmit(index, layero){
			var body = layer.getChildFrame('body', index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			layer.close(index);
		}
        
    </script>
</body>
</html>